//pnt_add.c
#include <stdio.h>
#include <stdlib.h>
#define SIZE 4

int main()
{
	short dates[SIZE];
	short * pti;
	short index;
	double bills[SIZE];
	double * ptf;
	pti = dates;
	ptf = bills;
	printf("%23s %10s\n","short","double");
	for(index = 0; index <SIZE; index++)
		printf("pointers + %d: %10p %10p\n",
			index, pti + index,ptf +index );
	return 0;
}

//
dates + 2 == &dates[2] //相同的地址
*(dates + 2) == dates[2] //相同的值

//
* (dates + 2) //dates 的第三个元素的值
*data //第一个元素的值加2

//简化版月份程序
#define months 12
int main(){
	int day[months] = {the days of 12 months};
	int index

	for(index = 0;index < months;index++)
		printf("months %2d has %d days\n",index + 1,*(days + index));
	return 0;
}//days 为数组days 首元素所在地址
// *(days + index) == days[index]

/*编写一个返回数组内所有元素和的函数*/
total = sum (data);
int sum(int * dataP,int n)/*因为data同时表示数组，及数组第一个元素的地址，
故定义指向int型变量的指针作为形式参量,int * dataP同时传递了数组地址和数组类型*/
{
	int i;
	int total = 0;
	for(i = 0; i < n; i++){
		total += data[i];
	}
	return total;
}














